﻿using System.Windows.Controls;

namespace MetroCalendar.Controls
{
    public partial class TabTitleItem : UserControl
    {
        private bool _isSelected;
        private bool _isEnabled;

        public TabPage AssociatedPage { get; set; }
        public bool IsSelected 
        {
            get
            {
                return _isSelected;
            }
            set
            {
                _isSelected = (bool)value;

                if (_isSelected)
                {
                    LayoutRoot.Background = TabConfigs.SelectedTabTitleItemBackground;
                    Title.Foreground = TabConfigs.SelectedTabTitleItemForeground;
                }
                else
                {
                    LayoutRoot.Background = TabConfigs.UnselectedTabTitleItemBackground;
                    Title.Foreground = TabConfigs.UnselectedTabTitleItemForeground;
                }
            }
        }

        public new bool IsEnabled
        {
            get
            {
                return _isEnabled;
            }
            set
            {
                _isEnabled = (bool)value;

                if (_isEnabled)
                {
                    Title.Foreground = TabConfigs.EnabledTabTitleItemForeground;
                }
                else
                {
                    Title.Foreground = TabConfigs.DisabledTabTitleItemForeground;
                }
            }
        }

        public TabTitleItem()
        {
            InitializeComponent();

            IsSelected = false;
            IsEnabled = true;
        }
    }
}
